import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { WebsiteVisitStatVO, WebsiteVisitStatForm, WebsiteVisitStatQuery } from '@/api/logic/websiteVisitStat/types';

/**
 * 查询站点浏览记录列表
 * @param query
 * @returns {*}
 */

export const listWebsiteVisitStat = (query?: WebsiteVisitStatQuery): AxiosPromise<WebsiteVisitStatVO[]> => {
  return request({
    url: '/logic/websiteVisitStat/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询站点浏览记录详细
 * @param visitStatId
 */
export const getWebsiteVisitStat = (visitStatId: string | number): AxiosPromise<WebsiteVisitStatVO> => {
  return request({
    url: '/logic/websiteVisitStat/' + visitStatId,
    method: 'get'
  });
};

/**
 * 新增站点浏览记录
 * @param data
 */
export const addWebsiteVisitStat = (data: WebsiteVisitStatForm) => {
  return request({
    url: '/logic/websiteVisitStat',
    method: 'post',
    data: data
  });
};

/**
 * 修改站点浏览记录
 * @param data
 */
export const updateWebsiteVisitStat = (data: WebsiteVisitStatForm) => {
  return request({
    url: '/logic/websiteVisitStat',
    method: 'put',
    data: data
  });
};

/**
 * 删除站点浏览记录
 * @param visitStatId
 */
export const delWebsiteVisitStat = (visitStatId: string | number | Array<string | number>) => {
  return request({
    url: '/logic/websiteVisitStat/' + visitStatId,
    method: 'delete'
  });
};
